package com.aurora.oa.work.view;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.aurora.oa.R;
import com.aurora.oa.activity.BaseActivity;
import com.aurora.oa.listener.OnRequestNoticeDetailListener;
import com.aurora.oa.model.RequestHttpModel;
import com.aurora.oa.model.RequestHttpModelImpl;
import com.aurora.oa.utils.ToastUtil;
import com.aurora.oa.work.bean.NoticeBean;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/4/20 0020.
 */
public class NoticeDetailActivity extends BaseActivity {
    @Bind(R.id.vebView)
    WebView vebView;
    String id;
    String url;
    RequestHttpModel model = new RequestHttpModelImpl();
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setMyContentView(R.layout.activity_webview);
        ButterKnife.bind(this);
        initTitlebar(true, "公告详情", true);
        getData();

    }

    private void getData() {
        id = getIntent().getStringExtra("id");
        model.getNoticeDetail(id, new OnRequestNoticeDetailListener() {
            @Override
            public void onRequestNoticeDetailListenerSuccess(String content) {

                WebSettings webSettings = vebView.getSettings();
                webSettings.setJavaScriptEnabled(true);
                vebView.setWebViewClient(new WebViewClient());
                vebView.loadDataWithBaseURL(null, content, "text/html", "utf-8", null);
            }

            @Override
            public void onRequestNoticeDetailListenerFail(String message) {
                ToastUtil.show(getApplicationContext(),message);
            }
        });
    }



}
